Copyright(C) 1994,1995,1996,1997 Terumasa KODAKA , Takeshi KONO


■Time stamper, hardware wait
Applicable to PC-H98 series, models with 486 or higher CPU, others
Explanation    o By using the time stamper or hardware wait port, you can obtain
                 a wait time that is independent of the CPU speed.
                 The hardware wait function is used when a very short wait is required to
                 ensure recovery time for peripheral devices. The time stamper is used when a
                 longer wait is required.
               o Not all PC-9800 models have the time stamper and hardware wait functions.
                 The presence or absence of the functions can be determined using the following method.
                 ---------------------------------+--------------------------------------------
                 Function                         | Determination method
                 ---------------------------------+--------------------------------------------
                 Time stamper function available  | (0000:0458h bit 7=1) or (0000:045Bh bit 2=1)
                 Hardware wait function available | (0000:0458h bit 7=1) or (0000:045Bh bit 7=1)
                 ---------------------------------+--------------------------------------------
                 * 0000:0458h bit 7 is the PC-H98 determination bit, 0000:045Bh bit 2 is the
                   time stamper function support flag, 0000:045Bh bit 7 is the hardware wait
                   function support flag
               o The I/O ports used for the time stamper and hardware wait are as follows.
                 ------------+-------+-----+--------------------------------------------------
                 I/O address | width | R/W | contents
                 ------------+-------+-----+--------------------------------------------------
                 005Ch       | WORD  |  R  | High resolution ARTIC port
                 005Eh       | WORD  |  R  | Low resolution ARTIC port
                 005Fh       | BYTE  |  W  | Hardware wait of 0.6 μs or more
                 045Fh       | BYTE  | R/W | Wait timing adjustment
                 ------------+-------+-----+--------------------------------------------------
Related          0000:0458h bit 7
                 0000:045Bh bit 7
                 0000:045Bh bit 2


I/O              005Ch,005Eh
Name             Time stamper
Target           Models with time stamper function
Function
                 ------------+-------+-----+--------------------------------------------------
                 I/O address | Width | R/W | Contents
                 ------------+-------+-----+--------------------------------------------------
                 005Ch       | WORD  |  R  | High-resolution ARTIC port
                 005Eh       | WORD  |  R  | Low-resolution ARTIC port
                 ------------+-------+-----+--------------------------------------------------
                 ●005Ch,Read: High-resolution ARTIC port
                 bit 15-0: Time stamp counter bits 15-0
                        * Resolution: Approx. 3.26μs
                          Maximum value: Approx. 213ms
                 ●005Eh,Read: Low-resolution ARTIC port
                 bit 15-0: Time stamp counter bits 23-8
                        * Resolution: Approx. 833μs
                          Maximum value: Approx. 54.6s

Explanation    o This indicates the count value of a 24-bit binary counter (ARTIC=A Relative Time Indication Counter)
                 that counts up at 307.2kHz. After counting up to FFFFFFh, it wraps around to 000000h.
               o The upper 8 bits of I/O 005Eh (low-resolution ARTIC port) also serve as a
                 hardware wait port. In other words, it works as an ARTIC port when reading,
                 and as a hardware wait port when writing.
               u Some technical data books have descriptions of the resolution and maximum
                 value of the low-resolution ARTIC port that differ from those of the actual device.
               u At reset, the counter starts from 0.
               u Access from odd addresses is also possible.

Related          0000:0458h bit 7
                 0000:045Bh bit 2


I/O              005Fh
Name             Hardware wait
Target           Models with hardware wait function
Function
                 ●Write: Hardware wait of 0.6μs or more
                 bit 7-0: Any value

Explanation    o If any value is output to I/O 005Fh, a wait of 0.6μs or more
                 will be applied by the hardware. It is used when securing recovery time for
                 peripheral devices.
               o I/O 005Fh also serves as a time stamper port. In other words, it works as a
                 hardware wait port when writing, and as an ARTIC port (upper 8 bits) when reading.
               u Even in models that do not explicitly support the hardware wait function
                 (models with the support flag set to 0), the I/O interface circuit has the
                 same function, so this function actually works. Timing was measured and
                 confirmed on a PC-9801VX21/RA21.
                 However, on the original PC-9801 E, F, and M, this port number overlaps with
                 the decoded image of the built-in 2D FDD I/F, so OUT to this address for the
                 wait must be avoided.

Related          0000:0458h bit 7
                 0000:045Bh bit 7
                 I/O 005Ch
                 I/O 045Fh


I/O              045Fh
Name             Wait timing adjustment
                 Undocumented
Target           Models with a wait port and a CPU of 486 or higher (excluding PC-H98, PC-9801FA)
Function
                 [READ/WRITE]
                 Bit 7-1: Set number of wait clocks (unit: CPU clock)
                 Bit 0: OUT 5Fh, AL wait insertion
                   1 = Insert
                   0 = Do not insert

Explanation    o For machines with a wait port and a CPU of 486 or higher (excluding PC-H98, PC-9801FA),
                 the length of the wait applied to the CPU can be adjusted with OUT 5Fh, AL.
               o OUT 5Fh, the wait time when AL is executed is determined by the CPU's
                 external clock frequency x the set number of wait clocks (the value output to
                 bits 7 to 1 of this port).
               u Writing an inappropriate value to this I/O may cause the machine to become unstable.

Related          0000:045Bh bit 7
                 I/O 005Fh